from fastapi import APIRouter, Depends, HTTPException , Query
from sqlalchemy.orm import Session
from crud import user as crud_user
from schemas import user as schema_user
from schemas import match as schema_match
from utils.database import SessionLocal
from crud import match as crud_match
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session
from typing import Annotated
from fastapi import Response
from fastapi.responses import JSONResponse
from fastapi.responses import FileResponse
# 新增导入

from utils.security import verify_password, create_access_token ,revoke_old_tokens ,validate_token
from utils.strategy import Strategy


router = APIRouter()
def get_db():
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close()

@router.get("/result",response_model=list[schema_match.Match])
def read_ends( start_time: int, end_time: int ,db: Session = Depends(get_db)):
    matchs = crud_match.get_with_times(db, start_time,end_time)
    return matchs
